import { defineAsyncComponent } from 'vue';

const loadComponent = (name: string) => {
    return defineAsyncComponent(() =>
        import(`/actual/path/to/${name}.js`)
            .then((module) => module.default)
            .catch((error) => {
                console.error('Failed to load component', error);
                // Provide a fallback component or return an empty component
                return {};
            })
    );
};

export default loadComponent;